#ifndef CHASSIS_DEVICE_H
#define CHASSIS_DEVICE_H

#include "../driver/driver_usart.h"
#include "../include/tool/log.h"
#include <iostream>
#include <string>
#include <thread>
#include <vector>

class C_chassisDevice
{
private:
    /* data */
    SerialDriver *m_chassis_serial;
    std::vector<uint8_t> m_chassisUsartBuffer;
public:
    /* data */
    uint8_t *m_recvBuf; // 储存串口接收到的数据

    C_chassisDevice(const char *_path, int _speed);
    ~C_chassisDevice();
    void sandUsartData(uint8_t *buf, uint32_t bufLen);
    void sandUsartData(std::vector<uint8_t> &sandSerialBuf);
    int32_t produceSerialData(float lineSpeed, float angleSpeed, std::vector<uint8_t> &sandSerialBuf);
    
    uint16_t getCRC16(uint8_t *usratBuf,  uint16_t length); // 校验码

    /********************************************************************
     * @author: tianxiaohuahua
     * @date: 23.8
     * @description: recvUsartData 接收底盘的数据
     * @input: void 
     * @return: void 
    *******************************************************************/
    int32_t recvUsartData(std::vector<uint8_t> &gnss_buffer);

};






#endif


